import {strategyArmory} from "@/apis";
import {strategy} from "sharp";
import {JSX} from "react";

export function StrategyArmory():JSX.Element
{
    const strategyArmoryHandle =async ()=>{
        const queryParams: URLSearchParams = new URLSearchParams(window.location.search);
        const strategyId:number = Number(queryParams.get("strategyId"));
        if(!strategyId){
            window.alert("请在请求地址中配置strategy");
            return;
        }
        const res:Response = await strategyArmory(strategyId);
        const{code, info} = await res.json();
        if(code !="0000"){
            window.alert("抽奖策略装配失败code:" + code + " info:" + info);
            return;
        }
    }
    return <div
        className= "px-6 py-2 mb-8 text-white bg-blue-500 rounded-full shadow-lg hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-300"
        onClick ={strategyArmoryHandle}>
        装配抽奖
    </div>
}